<table class="table table-striped table-list-select">
	<thead>
		<tr>
			<th> </th>
			<th>Jour</th>
			<th>Date</th>
			<th>Vol</th>
			<th>D&eacute;part</th>
			<th>Arriv&eacute;e</th>
			<!--<th>Dur&eacute;e</th>-->
			<th></th>
		</tr>
	</thead>
	<tbody>

	<?php
	$dateFound = false; 
	$i = 0;
	
	$dayOfWeekTranslated = array(
		'Monday'   =>'Lundi',
		'Tuesday'  =>'Mardi',
		'Wednesday'=>'Mercredi',
		'Thursday' =>'Jeudi',
		'Friday'   =>'Vendredi',
		'Saturday' =>'Samedi',
		'Sunday'   =>'Dimanche'
	);

	foreach($flights as $flight):

			if($flight->getActualDepartureTime() < time()) continue;

			$isSelected = false;
			if(!$dateFound && (date('Y-m-d',$flight->getActualDepartureTime()) == $date_wanted))
			{
				$isSelected = true;
				$dateFound  = true;
			}
			if(($i == count($flights) - 1)  && !$dateFound) $isSelected = true;
			$dayOfWeek = date('l',$flight->getActualDepartureTime());
			$i++;
			$isAvailable = ($places_wanted <= $flight->getPlacesLeft());
	?>
		<tr<?php if(!$isAvailable) echo ' class="disabled"'; elseif($isSelected) echo ' class="selected"'; ?>>
			<td><input type="radio" name="<?php echo $input_name ?>" value="<?php echo $flight->getFlightSchedule()->getId(); ?>_<?php echo date('Y-m-d',$flight->actual_departure_time) ?>"<?php if(!$isAvailable) echo ' disabled="disabled"'; elseif($isSelected) echo ' checked="checked"'?>/></td>
			<td><?php echo $dayOfWeekTranslated[$dayOfWeek]; ?></td>
			<td><?php echo date('d/m/Y',$flight->getActualDepartureTime()); ?></td>
			<td><?php echo $flight->getFlightSchedule()->getFlightCode();?></td>
			<td><?php echo $flight->getOriginAirport()->getName() ?> - <?php echo date('h:i',$flight->getActualDepartureTime()); ?></td>
			<td><?php echo $flight->getDestinationAirport()->getName() ?> - <?php echo date('h:i',$flight->getActualArrivalTime()); ?></td>
			<!--<td><?php echo $flight->getActualDuration(); ?></td>-->
			<td><?php //echo $flight->getPlacesLeft(); ?></td>
		</tr>
	<?php endforeach; ?>
	</tbody>
</table>